package com.szholly.pro.watergas_server.ps.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.szholly.pro.watergas_server.common.util.JsonUtil;
import com.szholly.pro.watergas_server.common.web.BaseController;
import com.szholly.pro.watergas_server.common.web.RequestUnit;
import com.szholly.pro.watergas_server.ps.service.QCExperimentalManagementService;
import com.szholly.data.general.RowBase;

@Controller  //质控实验管理
@RequestMapping("/QCExperimentalManagement/*")
public class QCExperimentalManagementController  extends BaseController { 
	
	@Autowired
	QCExperimentalManagementService qcExperimentalManagerService;
	
	/**
	 * 获取实验信息
	 * @param resq
	 * @param res
	 * @throws Exception
	 */
	@RequestMapping(value="/getExpDataList")
	public void getExpDataList(HttpServletRequest resq, HttpServletResponse res) throws Exception{
		Map<String, String> parm=queryStationQueryParams();
		List<RowBase> ExpList = qcExperimentalManagerService.getExpDataList(parm);
		List<RowBase> ExpDetailList =qcExperimentalManagerService.getExpDetailList(parm);
		HashMap<String,Object> data=new HashMap<>();
		data.put("ExpList", ExpList);
		data.put("ExpDetailList", ExpDetailList);
		outString(JsonUtil.ConvertObjectToJson(data));
	}
	
	/**
	 * 获取参数方法
	 * @return
	 */
	private Map<String,String> queryStationQueryParams() {
		Map<String,String> params = new HashMap<>();
		String MONITORINGTYPE=RequestUnit.getString("MONITORINGTYPE");
		String MonitorMethod=RequestUnit.getString("MonitorMethod");
		String CompanyCode=RequestUnit.getString("CompanyCode");
		String MONITORPARAMCODE=RequestUnit.getParameter("MONITORPARAMCODE");
		String QCType=RequestUnit.getString("QCType");
		String endDate=RequestUnit.getString("endDate");
		String startDate=RequestUnit.getString("startDate");
		params.put("MONITORINGTYPE", MONITORINGTYPE);
		params.put("MonitorMethod", MonitorMethod);
		params.put("CompanyCode", CompanyCode);
		params.put("QCType", QCType);
		params.put("endDate", endDate);
		params.put("startDate", startDate);
		params.put("MONITORPARAMCODE",MONITORPARAMCODE);
		return params;		
	}
}
